// Created from GenerationTemplate
// For Decisions HL7 Engine
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Reflection;
using DecisionsFramework.Design.Properties;
using Decisions.HL7.Generated.AbstractMessage;
using Decisions.HL7.DataTypes;
using ST = System.String;
using SI = System.String;
using TX = System.String;
using FT = System.String;
using IS = System.String;
using ID = System.String;
using SNM = System.String;

namespace Decisions.HL7.Message
{
    [DataContract]
	public class REF_I15 : AbstractMessage
    {
		/// Constructor
		public REF_I15() : base()
        {
			if (MSH != null) {
                MSH.MessageType = new MSG() { MessageCode = "REF", TriggerEvent = "I15" };
			}
        }

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("RF1",3)]
  	    [HL7Field(HL7Version.v23, 3, HL7Repeat.False, HL7Required.False,"RF1")]
  	    [HL7Field(HL7Version.v231, 3, HL7Repeat.False, HL7Required.False,"RF1")]
  	    [HL7Field(HL7Version.v24, 3, HL7Repeat.False, HL7Required.False,"RF1")]
  	    [HL7Field(HL7Version.v25, 3, HL7Repeat.False, HL7Required.False,"RF1")]
  	    [HL7Field(HL7Version.v251, 3, HL7Repeat.False, HL7Required.False,"RF1")]
  	    [HL7Field(HL7Version.v26, 4, HL7Repeat.False, HL7Required.False,"RF1")]
  	    [HL7Field(HL7Version.v27, 4, HL7Repeat.False, HL7Required.False,"RF1")]
	    public RF1 RF1 {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("AUTHORIZATION",5)]
  	    [HL7Field(HL7Version.v23, 5, HL7Repeat.False, HL7Required.False,"AUTHORIZATION_REF_I15")]
	    public AUTHORIZATION_REF_I15 AUTHORIZATION {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("PROVIDER",11)]
  	    [HL7Field(HL7Version.v23, 11, HL7Repeat.True, HL7Required.True,"PROVIDER_REF_I15")]
  	    [HL7Field(HL7Version.v231, 11, HL7Repeat.True, HL7Required.True,"PROVIDER_REF_I12")]
	    public PROVIDER_REF_I15[] PROVIDER {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("PID",19)]
  	    [HL7Field(HL7Version.v23, 19, HL7Repeat.False, HL7Required.True,"PID")]
  	    [HL7Field(HL7Version.v231, 19, HL7Repeat.False, HL7Required.True,"PID")]
  	    [HL7Field(HL7Version.v24, 19, HL7Repeat.False, HL7Required.True,"PID")]
  	    [HL7Field(HL7Version.v25, 12, HL7Repeat.False, HL7Required.True,"PID")]
  	    [HL7Field(HL7Version.v251, 12, HL7Repeat.False, HL7Required.True,"PID")]
  	    [HL7Field(HL7Version.v26, 13, HL7Repeat.False, HL7Required.True,"PID")]
  	    [HL7Field(HL7Version.v27, 13, HL7Repeat.False, HL7Required.True,"PID")]
	    public PID PID {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("NK1",22)]
  	    [HL7Field(HL7Version.v23, 22, HL7Repeat.True, HL7Required.False,"NK1")]
  	    [HL7Field(HL7Version.v231, 22, HL7Repeat.True, HL7Required.False,"NK1")]
  	    [HL7Field(HL7Version.v24, 22, HL7Repeat.True, HL7Required.False,"NK1")]
  	    [HL7Field(HL7Version.v25, 13, HL7Repeat.True, HL7Required.False,"NK1")]
  	    [HL7Field(HL7Version.v251, 13, HL7Repeat.True, HL7Required.False,"NK1")]
  	    [HL7Field(HL7Version.v26, 14, HL7Repeat.True, HL7Required.False,"NK1")]
  	    [HL7Field(HL7Version.v27, 14, HL7Repeat.True, HL7Required.False,"NK1")]
	    public NK1[] NK1 {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("GT1",27)]
  	    [HL7Field(HL7Version.v23, 27, HL7Repeat.True, HL7Required.False,"GT1")]
  	    [HL7Field(HL7Version.v231, 27, HL7Repeat.True, HL7Required.False,"GT1")]
  	    [HL7Field(HL7Version.v24, 27, HL7Repeat.True, HL7Required.False,"GT1")]
  	    [HL7Field(HL7Version.v25, 14, HL7Repeat.True, HL7Required.False,"GT1")]
  	    [HL7Field(HL7Version.v251, 14, HL7Repeat.True, HL7Required.False,"GT1")]
  	    [HL7Field(HL7Version.v26, 15, HL7Repeat.True, HL7Required.False,"GT1")]
  	    [HL7Field(HL7Version.v27, 15, HL7Repeat.True, HL7Required.False,"GT1")]
	    public GT1[] GT1 {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("INSURANCE",30)]
  	    [HL7Field(HL7Version.v23, 30, HL7Repeat.False, HL7Required.False,"INSURANCE_REF_I15")]
  	    [HL7Field(HL7Version.v231, 30, HL7Repeat.True, HL7Required.False,"INSURANCE_REF_I12")]
  	    [HL7Field(HL7Version.v24, 30, HL7Repeat.True, HL7Required.False,"INSURANCE_REF_I12")]
  	    [HL7Field(HL7Version.v25, 15, HL7Repeat.True, HL7Required.False,"INSURANCE_REF_I12")]
  	    [HL7Field(HL7Version.v251, 15, HL7Repeat.True, HL7Required.False,"INSURANCE_REF_I12")]
  	    [HL7Field(HL7Version.v26, 16, HL7Repeat.True, HL7Required.False,"INSURANCE_REF_I12")]
  	    [HL7Field(HL7Version.v27, 16, HL7Repeat.True, HL7Required.False,"INSURANCE_REF_I12")]
	    public INSURANCE_REF_I15[] INSURANCE {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("ACC",42)]
  	    [HL7Field(HL7Version.v23, 42, HL7Repeat.False, HL7Required.False,"ACC")]
  	    [HL7Field(HL7Version.v231, 42, HL7Repeat.False, HL7Required.False,"ACC")]
  	    [HL7Field(HL7Version.v24, 42, HL7Repeat.False, HL7Required.False,"ACC")]
  	    [HL7Field(HL7Version.v25, 22, HL7Repeat.False, HL7Required.False,"ACC")]
  	    [HL7Field(HL7Version.v251, 22, HL7Repeat.False, HL7Required.False,"ACC")]
  	    [HL7Field(HL7Version.v26, 23, HL7Repeat.False, HL7Required.False,"ACC")]
  	    [HL7Field(HL7Version.v27, 21, HL7Repeat.False, HL7Required.False,"ACC")]
	    public ACC ACC {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("DG1",46)]
  	    [HL7Field(HL7Version.v23, 46, HL7Repeat.True, HL7Required.False,"DG1")]
  	    [HL7Field(HL7Version.v231, 46, HL7Repeat.True, HL7Required.False,"DG1")]
  	    [HL7Field(HL7Version.v24, 46, HL7Repeat.True, HL7Required.False,"DG1")]
  	    [HL7Field(HL7Version.v25, 23, HL7Repeat.True, HL7Required.False,"DG1")]
  	    [HL7Field(HL7Version.v251, 23, HL7Repeat.True, HL7Required.False,"DG1")]
  	    [HL7Field(HL7Version.v26, 24, HL7Repeat.True, HL7Required.False,"DG1")]
  	    [HL7Field(HL7Version.v27, 22, HL7Repeat.True, HL7Required.False,"DG1")]
	    public DG1[] DG1 {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("DRG",51)]
  	    [HL7Field(HL7Version.v23, 51, HL7Repeat.True, HL7Required.False,"DRG")]
  	    [HL7Field(HL7Version.v231, 51, HL7Repeat.True, HL7Required.False,"DRG")]
  	    [HL7Field(HL7Version.v24, 51, HL7Repeat.True, HL7Required.False,"DRG")]
  	    [HL7Field(HL7Version.v25, 24, HL7Repeat.True, HL7Required.False,"DRG")]
  	    [HL7Field(HL7Version.v251, 24, HL7Repeat.True, HL7Required.False,"DRG")]
  	    [HL7Field(HL7Version.v26, 25, HL7Repeat.True, HL7Required.False,"DRG")]
  	    [HL7Field(HL7Version.v27, 23, HL7Repeat.True, HL7Required.False,"DRG")]
	    public DRG[] DRG {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("AL1",56)]
  	    [HL7Field(HL7Version.v23, 56, HL7Repeat.True, HL7Required.False,"AL1")]
  	    [HL7Field(HL7Version.v231, 56, HL7Repeat.True, HL7Required.False,"AL1")]
  	    [HL7Field(HL7Version.v24, 56, HL7Repeat.True, HL7Required.False,"AL1")]
  	    [HL7Field(HL7Version.v25, 25, HL7Repeat.True, HL7Required.False,"AL1")]
  	    [HL7Field(HL7Version.v251, 25, HL7Repeat.True, HL7Required.False,"AL1")]
  	    [HL7Field(HL7Version.v26, 26, HL7Repeat.True, HL7Required.False,"AL1")]
  	    [HL7Field(HL7Version.v27, 24, HL7Repeat.True, HL7Required.False,"AL1")]
	    public AL1[] AL1 {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("PROCEDURE",59)]
  	    [HL7Field(HL7Version.v23, 59, HL7Repeat.False, HL7Required.False,"PROCEDURE_REF_I15")]
  	    [HL7Field(HL7Version.v231, 59, HL7Repeat.True, HL7Required.False,"PROCEDURE_REF_I12")]
  	    [HL7Field(HL7Version.v24, 59, HL7Repeat.True, HL7Required.False,"PROCEDURE_REF_I12")]
  	    [HL7Field(HL7Version.v25, 26, HL7Repeat.True, HL7Required.False,"PROCEDURE_REF_I12")]
  	    [HL7Field(HL7Version.v251, 26, HL7Repeat.True, HL7Required.False,"PROCEDURE_REF_I12")]
  	    [HL7Field(HL7Version.v26, 27, HL7Repeat.True, HL7Required.False,"PROCEDURE_REF_I12")]
  	    [HL7Field(HL7Version.v27, 25, HL7Repeat.True, HL7Required.False,"PROCEDURE_REF_I12")]
	    public PROCEDURE_REF_I15[] PROCEDURE {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("RESULTS",70)]
  	    [HL7Field(HL7Version.v23, 70, HL7Repeat.False, HL7Required.False,"RESULTS_REF_I15")]
	    public RESULTS_REF_I15 RESULTS {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("VISIT",90)]
  	    [HL7Field(HL7Version.v23, 90, HL7Repeat.False, HL7Required.False,"VISIT_REF_I15")]
	    public VISIT_REF_I15 VISIT {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("NTE",104)]
  	    [HL7Field(HL7Version.v23, 104, HL7Repeat.True, HL7Required.False,"NTE")]
  	    [HL7Field(HL7Version.v231, 103, HL7Repeat.True, HL7Required.False,"NTE")]
  	    [HL7Field(HL7Version.v24, 103, HL7Repeat.True, HL7Required.False,"NTE")]
  	    [HL7Field(HL7Version.v25, 55, HL7Repeat.True, HL7Required.False,"NTE")]
  	    [HL7Field(HL7Version.v251, 55, HL7Repeat.True, HL7Required.False,"NTE")]
  	    [HL7Field(HL7Version.v26, 52, HL7Repeat.True, HL7Required.False,"NTE")]
  	    [HL7Field(HL7Version.v27, 44, HL7Repeat.True, HL7Required.False,"NTE")]
	    public NTE[] NTE {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("AUTHORIZATION_CONTACT",5)]
  	    [HL7Field(HL7Version.v231, 5, HL7Repeat.False, HL7Required.False,"AUTHORIZATION_CONTACT_REF_I12")]
  	    [HL7Field(HL7Version.v24, 5, HL7Repeat.False, HL7Required.False,"AUTHORIZATION_CONTACT_REF_I12")]
  	    [HL7Field(HL7Version.v25, 4, HL7Repeat.False, HL7Required.False,"AUTHORIZATION_CONTACT_REF_I12")]
  	    [HL7Field(HL7Version.v251, 4, HL7Repeat.False, HL7Required.False,"AUTHORIZATION_CONTACT_REF_I12")]
  	    [HL7Field(HL7Version.v26, 5, HL7Repeat.False, HL7Required.False,"AUTHORIZATION_CONTACT_REF_I12")]
  	    [HL7Field(HL7Version.v27, 5, HL7Repeat.False, HL7Required.False,"AUTHORIZATION_CONTACT_REF_I12")]
	    public AUTHORIZATION_CONTACT_REF_I12 AUTHORIZATION_CONTACT {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("OBSERVATION",69)]
  	    [HL7Field(HL7Version.v231, 69, HL7Repeat.True, HL7Required.False,"OBSERVATION_REF_I12")]
  	    [HL7Field(HL7Version.v24, 69, HL7Repeat.True, HL7Required.False,"OBSERVATION_REF_I12")]
  	    [HL7Field(HL7Version.v25, 35, HL7Repeat.True, HL7Required.False,"OBSERVATION_REF_I12")]
  	    [HL7Field(HL7Version.v251, 35, HL7Repeat.True, HL7Required.False,"OBSERVATION_REF_I12")]
  	    [HL7Field(HL7Version.v26, 36, HL7Repeat.True, HL7Required.False,"OBSERVATION_REF_I12")]
  	    [HL7Field(HL7Version.v27, 32, HL7Repeat.True, HL7Required.False,"OBSERVATION_REF_I12")]
	    public OBSERVATION_REF_I12[] OBSERVATION {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("PATIENT_VISIT",89)]
  	    [HL7Field(HL7Version.v231, 89, HL7Repeat.False, HL7Required.False,"PATIENT_VISIT_REF_I12")]
  	    [HL7Field(HL7Version.v24, 89, HL7Repeat.False, HL7Required.False,"PATIENT_VISIT_REF_I12")]
  	    [HL7Field(HL7Version.v25, 51, HL7Repeat.False, HL7Required.False,"PATIENT_VISIT_REF_I12")]
  	    [HL7Field(HL7Version.v251, 51, HL7Repeat.False, HL7Required.False,"PATIENT_VISIT_REF_I12")]
  	    [HL7Field(HL7Version.v26, 48, HL7Repeat.False, HL7Required.False,"PATIENT_VISIT_REF_I12")]
  	    [HL7Field(HL7Version.v27, 40, HL7Repeat.False, HL7Required.False,"PATIENT_VISIT_REF_I12")]
	    public PATIENT_VISIT_REF_I12 PATIENT_VISIT {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("PROVIDER_CONTACT",11)]
  	    [HL7Field(HL7Version.v24, 11, HL7Repeat.True, HL7Required.True,"PROVIDER_CONTACT_REF_I12")]
  	    [HL7Field(HL7Version.v25, 8, HL7Repeat.True, HL7Required.True,"PROVIDER_CONTACT_REF_I12")]
  	    [HL7Field(HL7Version.v251, 8, HL7Repeat.True, HL7Required.True,"PROVIDER_CONTACT_REF_I12")]
  	    [HL7Field(HL7Version.v26, 9, HL7Repeat.True, HL7Required.True,"PROVIDER_CONTACT_REF_I12")]
  	    [HL7Field(HL7Version.v27, 9, HL7Repeat.True, HL7Required.True,"PROVIDER_CONTACT_REF_I12")]
	    public PROVIDER_CONTACT_REF_I12[] PROVIDER_CONTACT {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("SFT",2)]
  	    [HL7Field(HL7Version.v25, 2, HL7Repeat.True, HL7Required.False,"SFT")]
  	    [HL7Field(HL7Version.v251, 2, HL7Repeat.True, HL7Required.False,"SFT")]
  	    [HL7Field(HL7Version.v26, 2, HL7Repeat.True, HL7Required.False,"SFT")]
  	    [HL7Field(HL7Version.v27, 2, HL7Repeat.True, HL7Required.False,"SFT")]
	    public SFT[] SFT {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("UAC",3)]
  	    [HL7Field(HL7Version.v26, 3, HL7Repeat.False, HL7Required.False,"UAC")]
  	    [HL7Field(HL7Version.v27, 3, HL7Repeat.False, HL7Required.False,"UAC")]
	    public UAC UAC {get;set;}



		#region Parser Helpers and Conrete Impls

        internal override Stack<string> ConsumeTextSegments(Stack<string> availableData, HL7ParserOptions options) {

				if (HL7Version.v23 == options.Version) {
		 RF1 = PopSegmentParseAndCheckRequired<RF1>(availableData, options, "RF1");
		 AUTHORIZATION = ProcessGroup<AUTHORIZATION_REF_I15>(availableData, options, "AUTHORIZATION");
		 PROVIDER = ProcessGroupArray<PROVIDER_REF_I15>(availableData, options, "PROVIDER");
		 PID = PopSegmentParseAndCheckRequired<PID>(availableData, options, "PID");
		 NK1 = PopSegmentParseAndCheckRequiredArray<NK1>(availableData, options, "NK1");
		 GT1 = PopSegmentParseAndCheckRequiredArray<GT1>(availableData, options, "GT1");
		 INSURANCE = ProcessGroupArray<INSURANCE_REF_I15>(availableData, options, "INSURANCE");
		 ACC = PopSegmentParseAndCheckRequired<ACC>(availableData, options, "ACC");
		 DG1 = PopSegmentParseAndCheckRequiredArray<DG1>(availableData, options, "DG1");
		 DRG = PopSegmentParseAndCheckRequiredArray<DRG>(availableData, options, "DRG");
		 AL1 = PopSegmentParseAndCheckRequiredArray<AL1>(availableData, options, "AL1");
		 PROCEDURE = ProcessGroupArray<PROCEDURE_REF_I15>(availableData, options, "PROCEDURE");
		 RESULTS = ProcessGroup<RESULTS_REF_I15>(availableData, options, "RESULTS");
		 VISIT = ProcessGroup<VISIT_REF_I15>(availableData, options, "VISIT");
		 NTE = PopSegmentParseAndCheckRequiredArray<NTE>(availableData, options, "NTE");
		}
		if (HL7Version.v231 == options.Version) {
		 RF1 = PopSegmentParseAndCheckRequired<RF1>(availableData, options, "RF1");
		 PROVIDER = ProcessGroupArray<PROVIDER_REF_I15>(availableData, options, "PROVIDER");
		 PID = PopSegmentParseAndCheckRequired<PID>(availableData, options, "PID");
		 NK1 = PopSegmentParseAndCheckRequiredArray<NK1>(availableData, options, "NK1");
		 GT1 = PopSegmentParseAndCheckRequiredArray<GT1>(availableData, options, "GT1");
		 INSURANCE = ProcessGroupArray<INSURANCE_REF_I15>(availableData, options, "INSURANCE");
		 ACC = PopSegmentParseAndCheckRequired<ACC>(availableData, options, "ACC");
		 DG1 = PopSegmentParseAndCheckRequiredArray<DG1>(availableData, options, "DG1");
		 DRG = PopSegmentParseAndCheckRequiredArray<DRG>(availableData, options, "DRG");
		 AL1 = PopSegmentParseAndCheckRequiredArray<AL1>(availableData, options, "AL1");
		 PROCEDURE = ProcessGroupArray<PROCEDURE_REF_I15>(availableData, options, "PROCEDURE");
		 NTE = PopSegmentParseAndCheckRequiredArray<NTE>(availableData, options, "NTE");
		 AUTHORIZATION_CONTACT = ProcessGroup<AUTHORIZATION_CONTACT_REF_I12>(availableData, options, "AUTHORIZATION_CONTACT");
		 OBSERVATION = ProcessGroupArray<OBSERVATION_REF_I12>(availableData, options, "OBSERVATION");
		 PATIENT_VISIT = ProcessGroup<PATIENT_VISIT_REF_I12>(availableData, options, "PATIENT_VISIT");
		}
		if (HL7Version.v24 == options.Version) {
		 RF1 = PopSegmentParseAndCheckRequired<RF1>(availableData, options, "RF1");
		 PID = PopSegmentParseAndCheckRequired<PID>(availableData, options, "PID");
		 NK1 = PopSegmentParseAndCheckRequiredArray<NK1>(availableData, options, "NK1");
		 GT1 = PopSegmentParseAndCheckRequiredArray<GT1>(availableData, options, "GT1");
		 INSURANCE = ProcessGroupArray<INSURANCE_REF_I15>(availableData, options, "INSURANCE");
		 ACC = PopSegmentParseAndCheckRequired<ACC>(availableData, options, "ACC");
		 DG1 = PopSegmentParseAndCheckRequiredArray<DG1>(availableData, options, "DG1");
		 DRG = PopSegmentParseAndCheckRequiredArray<DRG>(availableData, options, "DRG");
		 AL1 = PopSegmentParseAndCheckRequiredArray<AL1>(availableData, options, "AL1");
		 PROCEDURE = ProcessGroupArray<PROCEDURE_REF_I15>(availableData, options, "PROCEDURE");
		 NTE = PopSegmentParseAndCheckRequiredArray<NTE>(availableData, options, "NTE");
		 AUTHORIZATION_CONTACT = ProcessGroup<AUTHORIZATION_CONTACT_REF_I12>(availableData, options, "AUTHORIZATION_CONTACT");
		 OBSERVATION = ProcessGroupArray<OBSERVATION_REF_I12>(availableData, options, "OBSERVATION");
		 PATIENT_VISIT = ProcessGroup<PATIENT_VISIT_REF_I12>(availableData, options, "PATIENT_VISIT");
		 PROVIDER_CONTACT = ProcessGroupArray<PROVIDER_CONTACT_REF_I12>(availableData, options, "PROVIDER_CONTACT");
		}
		if (HL7Version.v25 == options.Version) {
		 RF1 = PopSegmentParseAndCheckRequired<RF1>(availableData, options, "RF1");
		 PID = PopSegmentParseAndCheckRequired<PID>(availableData, options, "PID");
		 NK1 = PopSegmentParseAndCheckRequiredArray<NK1>(availableData, options, "NK1");
		 GT1 = PopSegmentParseAndCheckRequiredArray<GT1>(availableData, options, "GT1");
		 INSURANCE = ProcessGroupArray<INSURANCE_REF_I15>(availableData, options, "INSURANCE");
		 ACC = PopSegmentParseAndCheckRequired<ACC>(availableData, options, "ACC");
		 DG1 = PopSegmentParseAndCheckRequiredArray<DG1>(availableData, options, "DG1");
		 DRG = PopSegmentParseAndCheckRequiredArray<DRG>(availableData, options, "DRG");
		 AL1 = PopSegmentParseAndCheckRequiredArray<AL1>(availableData, options, "AL1");
		 PROCEDURE = ProcessGroupArray<PROCEDURE_REF_I15>(availableData, options, "PROCEDURE");
		 NTE = PopSegmentParseAndCheckRequiredArray<NTE>(availableData, options, "NTE");
		 AUTHORIZATION_CONTACT = ProcessGroup<AUTHORIZATION_CONTACT_REF_I12>(availableData, options, "AUTHORIZATION_CONTACT");
		 OBSERVATION = ProcessGroupArray<OBSERVATION_REF_I12>(availableData, options, "OBSERVATION");
		 PATIENT_VISIT = ProcessGroup<PATIENT_VISIT_REF_I12>(availableData, options, "PATIENT_VISIT");
		 PROVIDER_CONTACT = ProcessGroupArray<PROVIDER_CONTACT_REF_I12>(availableData, options, "PROVIDER_CONTACT");
		 SFT = PopSegmentParseAndCheckRequiredArray<SFT>(availableData, options, "SFT");
		}
		if (HL7Version.v251 == options.Version) {
		 RF1 = PopSegmentParseAndCheckRequired<RF1>(availableData, options, "RF1");
		 PID = PopSegmentParseAndCheckRequired<PID>(availableData, options, "PID");
		 NK1 = PopSegmentParseAndCheckRequiredArray<NK1>(availableData, options, "NK1");
		 GT1 = PopSegmentParseAndCheckRequiredArray<GT1>(availableData, options, "GT1");
		 INSURANCE = ProcessGroupArray<INSURANCE_REF_I15>(availableData, options, "INSURANCE");
		 ACC = PopSegmentParseAndCheckRequired<ACC>(availableData, options, "ACC");
		 DG1 = PopSegmentParseAndCheckRequiredArray<DG1>(availableData, options, "DG1");
		 DRG = PopSegmentParseAndCheckRequiredArray<DRG>(availableData, options, "DRG");
		 AL1 = PopSegmentParseAndCheckRequiredArray<AL1>(availableData, options, "AL1");
		 PROCEDURE = ProcessGroupArray<PROCEDURE_REF_I15>(availableData, options, "PROCEDURE");
		 NTE = PopSegmentParseAndCheckRequiredArray<NTE>(availableData, options, "NTE");
		 AUTHORIZATION_CONTACT = ProcessGroup<AUTHORIZATION_CONTACT_REF_I12>(availableData, options, "AUTHORIZATION_CONTACT");
		 OBSERVATION = ProcessGroupArray<OBSERVATION_REF_I12>(availableData, options, "OBSERVATION");
		 PATIENT_VISIT = ProcessGroup<PATIENT_VISIT_REF_I12>(availableData, options, "PATIENT_VISIT");
		 PROVIDER_CONTACT = ProcessGroupArray<PROVIDER_CONTACT_REF_I12>(availableData, options, "PROVIDER_CONTACT");
		 SFT = PopSegmentParseAndCheckRequiredArray<SFT>(availableData, options, "SFT");
		}
		if (HL7Version.v27 == options.Version) {
		 RF1 = PopSegmentParseAndCheckRequired<RF1>(availableData, options, "RF1");
		 PID = PopSegmentParseAndCheckRequired<PID>(availableData, options, "PID");
		 NK1 = PopSegmentParseAndCheckRequiredArray<NK1>(availableData, options, "NK1");
		 GT1 = PopSegmentParseAndCheckRequiredArray<GT1>(availableData, options, "GT1");
		 INSURANCE = ProcessGroupArray<INSURANCE_REF_I15>(availableData, options, "INSURANCE");
		 ACC = PopSegmentParseAndCheckRequired<ACC>(availableData, options, "ACC");
		 DG1 = PopSegmentParseAndCheckRequiredArray<DG1>(availableData, options, "DG1");
		 DRG = PopSegmentParseAndCheckRequiredArray<DRG>(availableData, options, "DRG");
		 AL1 = PopSegmentParseAndCheckRequiredArray<AL1>(availableData, options, "AL1");
		 PROCEDURE = ProcessGroupArray<PROCEDURE_REF_I15>(availableData, options, "PROCEDURE");
		 NTE = PopSegmentParseAndCheckRequiredArray<NTE>(availableData, options, "NTE");
		 AUTHORIZATION_CONTACT = ProcessGroup<AUTHORIZATION_CONTACT_REF_I12>(availableData, options, "AUTHORIZATION_CONTACT");
		 OBSERVATION = ProcessGroupArray<OBSERVATION_REF_I12>(availableData, options, "OBSERVATION");
		 PATIENT_VISIT = ProcessGroup<PATIENT_VISIT_REF_I12>(availableData, options, "PATIENT_VISIT");
		 PROVIDER_CONTACT = ProcessGroupArray<PROVIDER_CONTACT_REF_I12>(availableData, options, "PROVIDER_CONTACT");
		 SFT = PopSegmentParseAndCheckRequiredArray<SFT>(availableData, options, "SFT");
		 UAC = PopSegmentParseAndCheckRequired<UAC>(availableData, options, "UAC");
		}
			if (availableData != null && availableData.Count > 0) {
				ConsumeZSegmentsFromText(availableData, options);
			}
            return availableData;
        
        }

        private static Dictionary<string, bool> SEGMENT_VERSION_REQUIRED_MAP = new Dictionary<string, bool>();

		protected override Dictionary<string, bool> MAP_OF_SEGMENT_TO_REQUIRED
        {
            get
			{
				return SEGMENT_VERSION_REQUIRED_MAP;
			}
        }

		public override string HL7ENTITY_TYPE_NAME
        {
            get {
				return "REF_I15";
			}
        }

        static REF_I15() {

             SetupStaticPropertyMap(SEGMENT_VERSION_REQUIRED_MAP, typeof(REF_I15));

        }

		#endregion

		public override string GetER7(HL7ParserOptions options)
		{
			List<string> segmentData = new List<string>();
			if (MSH != null) {
				segmentData.Add(MSH.GetER7(options));
			}
			if (RF1 != null) {
				segmentData.Add(RF1.GetER7(options));
			}
			if (AUTHORIZATION != null) {
				segmentData.Add(AUTHORIZATION.GetER7(options));
			}
			if (PROVIDER != null && PROVIDER.Length > 0) {
				for (int i = 0; i < PROVIDER.Length; i++) {
					segmentData.Add(PROVIDER[i].GetER7(options));
				}
			}
			if (PID != null) {
				segmentData.Add(PID.GetER7(options));
			}
			if (NK1 != null && NK1.Length > 0) {
				for (int i = 0; i < NK1.Length; i++) {
					segmentData.Add(NK1[i].GetER7(options));
				}
			}
			if (GT1 != null && GT1.Length > 0) {
				for (int i = 0; i < GT1.Length; i++) {
					segmentData.Add(GT1[i].GetER7(options));
				}
			}
			if (INSURANCE != null && INSURANCE.Length > 0) {
				for (int i = 0; i < INSURANCE.Length; i++) {
					segmentData.Add(INSURANCE[i].GetER7(options));
				}
			}
			if (ACC != null) {
				segmentData.Add(ACC.GetER7(options));
			}
			if (DG1 != null && DG1.Length > 0) {
				for (int i = 0; i < DG1.Length; i++) {
					segmentData.Add(DG1[i].GetER7(options));
				}
			}
			if (DRG != null && DRG.Length > 0) {
				for (int i = 0; i < DRG.Length; i++) {
					segmentData.Add(DRG[i].GetER7(options));
				}
			}
			if (AL1 != null && AL1.Length > 0) {
				for (int i = 0; i < AL1.Length; i++) {
					segmentData.Add(AL1[i].GetER7(options));
				}
			}
			if (PROCEDURE != null && PROCEDURE.Length > 0) {
				for (int i = 0; i < PROCEDURE.Length; i++) {
					segmentData.Add(PROCEDURE[i].GetER7(options));
				}
			}
			if (RESULTS != null) {
				segmentData.Add(RESULTS.GetER7(options));
			}
			if (VISIT != null) {
				segmentData.Add(VISIT.GetER7(options));
			}
			if (NTE != null && NTE.Length > 0) {
				for (int i = 0; i < NTE.Length; i++) {
					segmentData.Add(NTE[i].GetER7(options));
				}
			}
			if (AUTHORIZATION_CONTACT != null) {
				segmentData.Add(AUTHORIZATION_CONTACT.GetER7(options));
			}
			if (OBSERVATION != null && OBSERVATION.Length > 0) {
				for (int i = 0; i < OBSERVATION.Length; i++) {
					segmentData.Add(OBSERVATION[i].GetER7(options));
				}
			}
			if (PATIENT_VISIT != null) {
				segmentData.Add(PATIENT_VISIT.GetER7(options));
			}
			if (PROVIDER_CONTACT != null && PROVIDER_CONTACT.Length > 0) {
				for (int i = 0; i < PROVIDER_CONTACT.Length; i++) {
					segmentData.Add(PROVIDER_CONTACT[i].GetER7(options));
				}
			}
			if (SFT != null && SFT.Length > 0) {
				for (int i = 0; i < SFT.Length; i++) {
					segmentData.Add(SFT[i].GetER7(options));
				}
			}
			if (UAC != null) {
				segmentData.Add(UAC.GetER7(options));
			}
           segmentData.AddRange(GetZSegmentsER7(options));
		   return string.Join(HL7ParserConstants.SEGMENT_SEPARATOR, segmentData.ToArray());
        
        }


    }
}

